<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="bean.entity.*,bean.dal.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<jsp:include page="top.jsp"></jsp:include>
	<script type="text/javascript" >
		function check(){
			var tel=document.getElementById('tel').value;
			var password=document.getElementById('password').value;
			var username=document.getElementById('username').value;
			var location=document.getElementById('location').value;
			if(tel==""||tel==null){
				window.alert("电话不能为空！");
				document.update.tel.focus();
				return false;
			}
			if(username==""||username==null){
				window.alert("姓名不能为空！");
				document.update.username.focus();
				return false;
			}
			if(password==""||password==null){
				window.alert("密码不能为空！");
				document.update.password.focus();
				return false;
			}
			if(location==""||location==null){
				window.alert("地址不能为空！");
				document.update.location.focus();
				return false;
			}
			return true;
		}
	</script>


	<%
		String msg = (String) session.getAttribute("msg");
		session.setAttribute("msg","");
		String userid= (String) session.getAttribute("userid");
		if(userid==null) userid="";
		User user= new User();
		UserManager userM=new UserManager();
		user=userM.getUserByUserId(userid);
	%>
    <form id="bigBox" method="POST" action="/express/servlet/UserLogin?role=user&modth=update&id=<%=user.getId() %>" name="update" onsubmit="return check()">
        <h1>用户个人信息</h1>
        <font color="red">
            <span id="message">
                <%if(msg==null){msg="";} %>
                    <%=msg %>
            </span>
        </font>
        <!-- 用户个人信息界面容器 -->
        <div class="inputBox">
            <!-- 用户账号 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-phone"></i>
                    账号:
                </span>
                <span><%=user.getUserid() %></span>
            </div>
            <!-- 用户电话 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-shouye"></i>
                    电话:
                </span>
                <input type="text" id="tel" name="tel" placeholder="Userphone" value="<%=user.getTel() %>"  >
            </div>
            <!-- 用户姓名 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-user"></i>
                    姓名:
                </span>
                <input type="text" id="username" name="username" placeholder="Username" value="<%=user.getUsername() %>" >
            </div>
            <!-- 密码 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-password"></i>
                    密码:
                </span>
                <input type="text" id="password" name="password" placeholder="Password">
            </div>
            <!-- 用户地址 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-address"></i>
                    地址:
                </span>
                <input type="text" id="location" name="location" placeholder="Address" value="<%=user.getLocation() %>" >
            </div>
            <!-- 用户积分 -->
            <div class="inputText">
                <span>
                    <i class="iconfont icon-jifen"></i>
                    积分:
                </span>
                <span><%=user.getIntegration() %></span>
            </div>
            <div class="inputText">
                <span>
                    <i class=""></i>
                    优惠券金额:
                </span>
                <span><%=user.getCreditex() %>元</span>
            </div>
            <!-- 修改按钮 -->
            <input type="submit" class="inputButton" value="保存">
            <!-- 返回按钮 -->
            <a href="user/index.jsp">
                <input type="button" class="inputButton" value="返回">
            </a>
        </div>
    </form>
  </body>
</html>
